package com.xlong.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xlong.service.SaTokenService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@RestController
@Slf4j
@RequestMapping(value = "/user/",produces = "application/json;charset=UTF-8")
@Api(value = "用户登录接口", tags = {"用户登录接口"})
public class SaTokenController {
	
	@Autowired
	private SaTokenService saTokenService;
	
	@ApiOperation(value="用户登录",notes="根据用户名密码登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name="usercode", dataType="String", required=true, value="用户名"),
            @ApiImplicitParam(name="password", dataType="String", required=true, value="密码")
    })
	@PostMapping(value = "/auth/dologin")
	public String doLogin(@RequestBody String jsonstr) {
        
        return saTokenService.AuthLogin(jsonstr);
    }
	
	@GetMapping(value = "/testactive")
	public String testActive() {
		return saTokenService.TestActive();
	}
}
